PlutoTest.jl
This notebook introduces visual testing:
is_good_boy (generic function with 1 method)Tests have time-travel functionality built in! Click on the tests above.
Time travel
This notebook contains visual debugging:
(You need Pluto#main to run this notebook)
@test_deprecated (macro with 1 method)Type definitions
AnyTest macro
:(1 + $(Expr(:$, :(Main.workspace#5.Computed([2, 3])))))
:($(Expr(:$, :(Main.workspace#5.Computed(1 + $(Expr(:$, :(Main.workspace#5.Computed([2, 3])))))))))
test (generic function with 1 method)begin
var"#692#expr_raw" = $(QuoteNode(:(x == [1, 2 + i])))
try
var"#693#steps" = Expr[:($(Expr(:$, :(Main.workspace#5.Computed(x)))) == [1, 2 + i]), :($(Expr(:$, :(Main.workspace#5.Computed(x)))) == $(Expr(:$, :(Main.workspace#5.Computed([1, 2 + i]))))), :($(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(x)))) == $(Expr(:$, :(Main.workspace#5.Computed([1, 2 + i])))))))))]
var"#694#result" = Main.workspace#9.expand_computed(Main.workspace#9.last(var"#693#steps"))
if var"#694#result" === true
Main.workspace#9.CorrectCall(var"#692#expr_raw", var"#693#steps")
else
Main.workspace#9.WrongCall(var"#692#expr_raw", var"#693#steps")
end
catch var"#697#e"
Main.workspace#9.rethrow(var"#697#e")
end
end
1
3
falsefalsealways_false (generic function with 1 method)"asdasd"
"asd"
"asd asd"
"asd"
"asdasd"
"asd"
"asdasd"
"asd"
"asdasd"
"asd"
"asdasd"
"asd"
"asdasd"
"asd"
trueflatmap (generic function with 1 method)commas (generic function with 2 methods)embed_display (generic function with 1 method)div (generic function with 1 method)div (generic function with 2 methods)prettycolors (generic function with 1 method)remove_linenums (generic function with 1 method)remove_linenums (generic function with 2 methods)DEbugging 1
onestep (generic function with 1 method)expr_debug (generic function with 1 method)UInt64expr_hash (generic function with 1 method)expr_hash (generic function with 2 methods)let
r = if rand(Bool)
20
else
16
end
y = sqrt(4)
y == sqrt(sqrt(r))
end
Debugging 1.5
computed (generic function with 1 method)expand_computed (generic function with 1 method)expand_computed (generic function with 2 methods)expand_computed (generic function with 3 methods)onestep_light (generic function with 1 method)lazyevalwrap (generic function with 1 method)lazycomputedwrap (generic function with 1 method):([1, 2] + $(Expr(:$, :(Main.workspace#5.Computed([1, 2, z]))))):(sqrt(first($(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))
:(sqrt($(Expr(:$, :(Main.workspace#5.Computed(first($(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))))))
:($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(first($(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))))))))))
@cool (macro with 1 method)@showme (macro with 1 method):($(Expr(:quote, :(a + $(Expr(:$, :b))))))Main.workspace#6LoadError: UndefVarError: workspace2594 not defined
in expression starting at /home/runner/work/disorganised-mess/disorganised-mess/testing and debugging 3 no interpolate.jl#==#fce0b2de-7f7b-4ce8-8a16-079428041fb8:2
Here is what happened, the most recent locations are first:
UndefVarError: z not defined
:(sqrt(first(Computed([1, 2]))))
Array{Expr}((1,))
1: Expr
head: Symbol call
args: Array{Any}((2,))
1: Symbol sqrt
2: Expr
head: Symbol call
args: Array{Any}((2,))
1: Symbol first
2: Computed
x: Array{Int64}((2,)) [1, 2]
Expr
head: Symbol block
args: Array{Any}((2,))
1: LineNumberNode
line: Int64 14
file: Symbol /home/runner/work/disorganised-mess/disorganised-mess/testing and debugging 3 no interpolate.jl#==#61688af2-169e-4c1f-a37f-cc7cc35679dc
2: Expr
head: Symbol vect
args: Array{Any}((1,))
1: Expr
head: Symbol call
args: Array{Any}((4,))
1: GlobalRef
mod: Module Core
name: Symbol _expr
2: QuoteNode
value: Symbol call
3: QuoteNode
value: Symbol sqrt
4: Expr
head: Symbol call
args: Array{Any}((4,))
1: GlobalRef
mod: Module Core
name: Symbol _expr
2: QuoteNode
value: Symbol call
3: QuoteNode
value: Symbol first
4: Expr
head: Symbol call
args: Array{Any}((2,))
1: GlobalRef
mod: Module Main.workspace#5
name: Symbol Computed
2: Expr
head: Symbol vect
args: Array{Any}((2,))
1: Int64 1
2: Int64 2
onestep_light (generic function with 2 methods):(2 + $(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :i)))))))
:($(Expr(:$, :(Main.workspace#5.Computed(2 + $(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :i)))))))))))
step_by_step (generic function with 1 method):(sqrt(length($(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))
:(sqrt($(Expr(:$, :(Main.workspace#5.Computed(length($(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))))))
:($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(length($(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))))))))))
:(1 + sqrt($(Expr(:$, :(Main.workspace#5.Computed(z))))))
:(1 + $(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(z))))))))))
:($(Expr(:$, :(Main.workspace#5.Computed(1 + $(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(z))))))))))))))
:(1 + sqrt($(Expr(:$, :z))))@eyo (macro with 1 method)syntax: "$" expression outside quote around /home/runner/work/disorganised-mess/disorganised-mess/testing and debugging 3 no interpolate.jl#==#611800fe-2ba5-4d89-a3aa-8933ec60bf2e:1
syntax: "$" expression outside quote
@eval_step_by_step (macro with 1 method)@wow (macro with 1 method)quote
[Expr[:(sqrt(sqrt($(Expr(:$, :(Main.workspace#5.Computed(3 + 2))))))), :(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(3 + 2))))))))))), :($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(3 + 2)))))))))))))))]...]
endquote
#= /home/runner/work/disorganised-mess/disorganised-mess/testing and debugging 3 no interpolate.jl#==#a661e172-6afb-42ff-bd43-bb5b787ee5ed:4 =#
[Expr[:(2342342 + $(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :i))))))), :($(Expr(:$, :(Main.workspace#5.Computed(2342342 + $(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :i)))))))))))]...]
endquote
#= /home/runner/work/disorganised-mess/disorganised-mess/testing and debugging 3 no interpolate.jl#==#a661e172-6afb-42ff-bd43-bb5b787ee5ed:4 =#
[Expr[:($(Expr(:$, :(Main.workspace#5.Computed(x)))) == [1, 2]), :($(Expr(:$, :(Main.workspace#5.Computed(x)))) == $(Expr(:$, :(Main.workspace#5.Computed([1, 2]))))), :($(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(x)))) == $(Expr(:$, :(Main.workspace#5.Computed([1, 2])))))))))]...]
end:($(Expr(:$, :(Main.workspace#5.Computed($(Expr(:(=), :xasdf, 123)))))))
UndefVarError: xasdf not defined
Here is what happened, the most recent locations are first:
quote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
2 + 3
4 + 5
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
4 + 5
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
sqrt(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))
endquote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))))))
endquote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
$(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))))))))))
end:($(Expr(:$, :(Main.workspace#5.Computed(begin
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
$(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))))))))))
end)))))can_interpret (generic function with 1 method)can_interpret_call_arg (generic function with 1 method)can_interpret_call_arg (generic function with 2 methods)truecan_interpret (generic function with 2 methods)Displaying
find_computed! (generic function with 1 method)find_computed! (generic function with 2 methods)find_computed! (generic function with 3 methods)find_computed (generic function with 1 method)slot! (generic function with 1 method)slot! (generic function with 2 methods)slot! (generic function with 3 methods)slot (generic function with 1 method)quote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + (7 - 6)
2 + 3
4 + 5
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))
2 + 3
4 + 5
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
2 + 3
4 + 5
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
4 + 5
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
sqrt(sqrt(sqrt(5)))
endquote
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
sqrt(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))
endquote
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))))))
endquote
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
$(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))))))))))
end:($(Expr(:$, :(Main.workspace#5.Computed(begin
$(Expr(:$, :(Main.workspace#5.Computed($(Expr(:$, :(Main.workspace#5.Computed(1 + 2)))) + $(Expr(:$, :(Main.workspace#5.Computed(7 - 6))))))))
$(Expr(:$, :(Main.workspace#5.Computed(2 + 3))))
$(Expr(:$, :(Main.workspace#5.Computed(4 + 5))))
$(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt($(Expr(:$, :(Main.workspace#5.Computed(sqrt(5)))))))))))))))
end)))))preish (generic function with 1 method)display_slotted (generic function with 1 method)plot (generic function with 1 method)@visual_debug (macro with 1 method)frames (generic function with 1 method)